home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / v8n16.arc / WIPE.BAT < prev   
DOS Batch File  |  1989-08-30  |  2KB  |  73 lines

  1. ECHO OFF
  2. :---------- WIPE.BAT ----------
  3.  
  4. CLS
  5. IF "%1"=="" GOTO USAGE
  6.  
  7. :- Create temp file for DEBUG input. This creates a
  8. :- temporary file that is 64K - 256 bytes of 0. This
  9. :- file is used to destroy the files specified by the user.
  10.  
  11. ECHO RBX    >  WIPE.$$$
  12. ECHO 0    >> WIPE.$$$
  13. ECHO RCX    >> WIPE.$$$
  14. ECHO FF00    >> WIPE.$$$
  15. ECHO F CS:100 L FF00 0 >> WIPE.$$$
  16. ECHO W    >> WIPE.$$$
  17. ECHO Q    >> WIPE.$$$
  18.  
  19. DEBUG WIPE.$$1 < WIPE.$$$ > NUL
  20. DEL WIPE.$$$
  21.  
  22. :- Top of loop for each input parameter to the batch file.
  23. :- Use shift to do multiple input parameters. 
  24. :- Only limit is 128 char cmd line.
  25.  
  26. :NEXTPARAM
  27. IF .%1==. GOTO :DONE
  28. IF NOT EXIST %1 GOTO NOFILE
  29.  
  30. :- One or more files, use file WIPE.$$1 created above to
  31. :- destroy the first 64K - 256 bytes of each file and 
  32. :- then delete the file.
  33.  
  34. ECHO.
  35. ECHO Files matching the specification:   %1
  36. ECHO.
  37. ECHO are about to be permanently destroyed!!
  38. ECHO To abort without deleting any files, press [CTRL-BREAK] or
  39. PAUSE
  40. FOR %%F IN (%1) DO COPY WIPE.$$1 %%F > NUL
  41. IF EXIST %1 DEL %1
  42. ECHO.
  43. ECHO %1 file(s) destroyed and deleted
  44. SHIFT
  45. GOTO NEXTPARAM
  46.  
  47. :- No files matching spec, tell user and continue
  48.  
  49. :NOFILE
  50. ECHO.
  51. ECHO No files of type:    %1
  52. ECHO.
  53. SHIFT
  54. GOTO NEXTPARAM
  55.  
  56. :- Define syntax to the user
  57.  
  58. :USAGE
  59. ECHO WIPE - Permanently destroy and delete a file or group of files.
  60. ECHO.
  61. ECHO Usage:
  62. ECHO.
  63. ECHO        WIPE filespec1 [filespec2] ... [filespecN]
  64. ECHO.
  65. ECHO where: filespec1, filespec2, ... filespecN may be any legal DOS file
  66. ECHO        specification. Each filespec may contain wildcard characters.
  67. ECHO.
  68.  
  69. :- All done, exit the batch file
  70.  
  71. :DONE
  72. if exist WIPE.$$1 del WIPE.$$1
  73.